import request from '@/utils/request'

// 查询sku列表
export function listSkuInfo(query) {
  return request({
    url: '/producer/skuInfo/list',
    method: 'get',
    params: query
  })
}

export function itemDetails(skuId) {
  return request({
    url: '/producer/item/details/'+skuId,
    method: 'get'
  })
}

export function searchSkuList(query) {
  return request({
    url: '/elastic/pmsSkuInfo/search',
    method: 'get',
    params: query
  })
}

// 查询sku详细
export function getSkuInfo(skuId) {
  return request({
    url: '/producer/skuInfo/' + skuId,
    method: 'get'
  })
}

// 新增sku
export function addSkuInfo(data) {
  return request({
    url: '/producer/skuInfo',
    method: 'post',
    data: data
  })
}

// 修改sku
export function updateSkuInfo(data) {
  return request({
    url: '/producer/skuInfo',
    method: 'put',
    data: data
  })
}

// 删除sku
export function delSkuInfo(skuId) {
  return request({
    url: '/producer/skuInfo/' + skuId,
    method: 'delete'
  })
}

export function addCartItem(data) {
  return request({
    url: '/producer/cartItem/addCartItem',
    method: 'post',
    data: data
  })
}

export function cartVoList() {
  return request({
    url: '/producer/cartItem/cartVoList',
    method: 'get',
  })
}

export function deleteCartItem(skuIds) {
  return request({
    url: '/producer/cartItem/deleteCartItem/'+skuIds,
    method: 'delete',
  })
}
